package vfs.common;

import vfs.common.rmi.RmiBroadcastListener;

import java.io.Serializable;
import java.util.List;

/**
 * Created by serge on 05.12.13.
 */
public class User implements Serializable
{
    private String name;
    private List<String> cd;
    private RmiBroadcastListener broadcastListener;

    public User(String name, RmiBroadcastListener broadcastListener)
    {
        this.name = name;
        this.broadcastListener = broadcastListener;
    }

    public RmiBroadcastListener getBroadcastListener()
    {
        return broadcastListener;
    }

    public String getName()
    {
        return name;
    }

    public List<String> getCd()
    {
        return cd;
    }

    public void setCd(List<String> cd)
    {
        this.cd = cd;
    }

    /** Name is considered in equals */
    @Override
    public boolean equals(Object o)
    {
        if (this == o)
        {
            return true;
        }
        if (o == null || getClass() != o.getClass())
        {
            return false;
        }

        User user = (User) o;

        if (!name.equals(user.name))
        {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode()
    {
        return name.hashCode();
    }
}
